home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / init.d / mountall.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2006-10-06  |  2.3 KB  |  112 lines

  1. #! /bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          mountall
  4. # Required-Start:    checkfs
  5. # Required-Stop: 
  6. # Should-Start:      lvm
  7. # Should-Stop:
  8. # Default-Start:     S
  9. # Default-Stop:
  10. # Short-Description: Mount all filesystems.
  11. # Description:
  12. ### END INIT INFO
  13.  
  14. PATH=/sbin:/bin
  15. . /lib/init/vars.sh
  16.  
  17. . /lib/lsb/init-functions
  18. . /lib/init/mount-functions.sh
  19.  
  20. do_start() {
  21.     #
  22.     # Mount local file systems in /etc/fstab.
  23.     #
  24.     pre_mountall
  25.     if [ "$VERBOSE" = no ]
  26.     then
  27.         log_action_begin_msg "Mounting local filesystems"
  28.         mount -a -t proc >/dev/null 2>&1  # Ignore error message due to /proc already being mounted
  29.         ES_TO_REPORT=$?
  30.         mount -a -t noproc,nfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs
  31.         ES=$?
  32.         ES_TO_REPORT=$(($ES_TO_REPORT | $ES))
  33.         if [ 0 = "$ES_TO_REPORT" ]
  34.         then
  35.             log_action_end_msg 0
  36.         else
  37.             log_action_end_msg 1 "code $ES_TO_REPORT"
  38.         fi
  39.     else
  40.         log_action_msg "Will now mount local filesystems"
  41.         mount -a -t proc >/dev/null 2>&1  # Ignore error message due to /proc already being mounted
  42.         ES=$?
  43.         [ 0 = "$ES" ] || log_failure_msg "Mounting proc filesystems failed with error code ${ES}."
  44.         mount -a -v -t noproc,nfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs
  45.         ES=$?
  46.         if [ 0 = "$ES" ]
  47.         then
  48.             log_success_msg "Done mounting local filesystems."
  49.         else
  50.             log_failure_msg "Mounting local filesystems failed with error code ${ES}."
  51.         fi
  52.     fi
  53.  
  54.     post_mountall
  55.  
  56.     case "$(uname -s)" in
  57.       *FreeBSD)
  58.         INITCTL=/etc/.initctl
  59.         ;;
  60.       *)
  61.         INITCTL=/dev/initctl
  62.         ;;
  63.     esac
  64.  
  65.     #
  66.     # We might have mounted something over /dev, see if
  67.     # /dev/initctl is there.
  68.     #
  69.     if [ ! -p $INITCTL ]
  70.     then
  71.         rm -f $INITCTL
  72.         mknod -m 600 $INITCTL p
  73.     fi
  74.     kill -USR1 1
  75.  
  76.     #
  77.     # Execute swapon command again, in case we want to swap to
  78.     # a file on a now mounted filesystem.
  79.     #
  80.     # Ignore 255 status due to swap already being enabled
  81.     #
  82.     if [ "$VERBOSE" = no ]
  83.     then
  84.         log_action_begin_msg "Activating swapfile swap"
  85.         swapon -a -e 2>/dev/null || :  # Stifle "Device or resource busy"
  86.         log_action_end_msg 0
  87.     else
  88.         log_action_msg "Will now activate swapfile swap"
  89.         swapon -a -e -v || :
  90.         log_success_msg "Done activating swapfile swap."
  91.     fi
  92. }
  93.  
  94. case "$1" in
  95.   start|"")
  96.     do_start
  97.     ;;
  98.   restart|reload|force-reload)
  99.     echo "Error: argument '$1' not supported" >&2
  100.     exit 3
  101.     ;;
  102.   stop)
  103.     # No-op
  104.     ;;
  105.   *)
  106.     echo "Usage: mountall.sh [start|stop]" >&2
  107.     exit 3
  108.     ;;
  109. esac
  110.  
  111. :
  112.